package com.clean.cleantotal

import android.annotation.SuppressLint
import android.content.Context
import android.os.Build
import coil.Coil
import coil.ImageLoader
import coil.decode.GifDecoder
import coil.decode.ImageDecoderDecoder
import com.clean.notification.app.BaseApplication
import com.drake.statelayout.StateConfig

class MyApp : BaseApplication() {

    companion object {
        @SuppressLint("StaticFieldLeak")
        lateinit var mContext: Context
    }

    override fun onCreate() {
        super.onCreate()
        mContext = this
        val imageLoader = ImageLoader.Builder(this).components {
            if (Build.VERSION.SDK_INT >= 28) {
                add(ImageDecoderDecoder.Factory())
            } else {
                add(GifDecoder.Factory())
            }
        }.build()
        //设置全局唯一实例
        Coil.setImageLoader(imageLoader)

        StateConfig.apply {
            emptyLayout = R.layout.empty_layout
        }

//        ForegroundNotifyService.startNotifyService(this)
    }

    override fun getAppName(): String {
        return getString(R.string.app_name)
    }

    override fun initFcmPort(): String {
        return "/com/smartclean/phone/rep"
    }

    override fun initFcmUrl(): String {
        return "https://www.smartcleanphone.com/"
    }
}